using System.Configuration;

namespace OrbitOne.Elmah.Presenter
{
    internal class RSSFeedConfigurationSection : ConfigurationSection
    {
        #region Properties
        [ConfigurationProperty("BaseUrl", IsRequired = true)]
        public string BaseUrl
        {
            get { return this["BaseUrl"].ToString(); }
            set { this["BaseUrl"] = value; }
        }
        [ConfigurationProperty("CompanyName", IsRequired = true)]
        public string CompanyName
        {
            get { return this["CompanyName"].ToString(); }
            set { this["CompanyName"] = value; }
        }
        [ConfigurationProperty("ErrorSearchPageurl", IsRequired = true)]
        public string ErrorSearchPageurl
        {
            get { return this["ErrorSearchPageurl"].ToString(); }
            set { this["ErrorSearchPageurl"] = value; }
        }
        [ConfigurationProperty("ErrorDetailPageurl", IsRequired = true)]
        public string ErrorDetailPageurl
        {
            get { return this["ErrorDetailPageurl"].ToString(); }
            set { this["ErrorDetailPageurl"] = value; }
        }
        [ConfigurationProperty("SenderEmail", IsRequired = true)]
        public string SenderEmail
        {
            get { return this["SenderEmail"].ToString(); }
            set { this["SenderEmail"] = value; }
        }
        [ConfigurationProperty("SenderName", IsRequired = true)]
        public string SenderName
        {
            get { return this["SenderName"].ToString(); }
            set { this["SenderName"] = value; }
        }
        #endregion

        #region Constructor
        public RSSFeedConfigurationSection(string baseUrl, string companyName, string errorSearchPageurl, string errorDetailPageurl, string senderEmail, string senderName)
        {
            this.BaseUrl = baseUrl;
            this.CompanyName = companyName;
            this.ErrorSearchPageurl = errorSearchPageurl;
            this.ErrorDetailPageurl = errorDetailPageurl;
            this.SenderEmail = senderEmail;
            this.SenderName = senderName;
        }

        public RSSFeedConfigurationSection() { }
        #endregion

        #region Static Methods
        public static RSSFeedConfigurationSection Load()
        {
            return (RSSFeedConfigurationSection)ConfigurationManager.GetSection("RSSFeedConfigurationSection");
        }
        #endregion
    }
}